home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-MIPS / PROCESSO.{_L < prev    next >
Text File  |  1999-09-17  |  7KB  |  243 lines

  1. /* $Id: processor.h,v 1.18 1998/10/14 20:31:12 ralf Exp $
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 1994 Waldorf GMBH
  8.  * Copyright (C) 1995, 1996, 1997, 1998 Ralf Baechle
  9.  * Modified further for R[236]000 compatibility by Paul M. Antoine
  10.  */
  11. #ifndef __ASM_MIPS_PROCESSOR_H
  12. #define __ASM_MIPS_PROCESSOR_H
  13.  
  14. #if !defined (_LANGUAGE_ASSEMBLY)
  15. #include <asm/cachectl.h>
  16. #include <asm/mipsregs.h>
  17. #include <asm/reg.h>
  18. #include <asm/system.h>
  19.  
  20. struct mips_cpuinfo {
  21.     unsigned long *pgd_quick;
  22.     unsigned long *pte_quick;
  23.     unsigned long pgtable_cache_sz;
  24. };
  25.  
  26. /*
  27.  * System setup and hardware flags..
  28.  * XXX: Should go into mips_cpuinfo.
  29.  */
  30. extern char wait_available;        /* only available on R4[26]00 */
  31. extern char cyclecounter_available;    /* only available from R4000 upwards. */
  32. extern char dedicated_iv_available;    /* some embedded MIPS like Nevada */
  33. extern char vce_available;        /* Supports VCED / VCEI exceptions */
  34.  
  35. extern struct mips_cpuinfo boot_cpu_data;
  36. extern unsigned int vced_count, vcei_count;
  37.  
  38. #ifdef __SMP__
  39. extern struct mips_cpuinfo cpu_data[];
  40. #define current_cpu_data cpu_data[smp_processor_id()]
  41. #else
  42. #define cpu_data &boot_cpu_data
  43. #define current_cpu_data boot_cpu_data
  44. #endif
  45.  
  46. /*
  47.  * Bus types (default is ISA, but people can check others with these..)
  48.  * MCA_bus hardcoded to 0 for now.
  49.  *
  50.  * This needs to be extended since MIPS systems are being delivered with
  51.  * numerous different types of bus systems.
  52.  */
  53. extern int EISA_bus;
  54. #define MCA_bus 0
  55. #define MCA_bus__is_a_macro /* for versions in ksyms.c */
  56.  
  57. /*
  58.  * MIPS has no problems with write protection
  59.  */
  60. #define wp_works_ok 1
  61. #define wp_works_ok__is_a_macro /* for versions in ksyms.c */
  62.  
  63. /* Lazy FPU handling on uni-processor */
  64. extern struct task_struct *last_task_used_math;
  65.  
  66. /*
  67.  * User space process size: 2GB. This is hardcoded into a few places,
  68.  * so don't change it unless you know what you are doing.  TASK_SIZE
  69.  * for a 64 bit kernel expandable to 8192EB, of which the current MIPS
  70.  * implementations will "only" be able to use 1TB ...
  71.  */
  72. #define TASK_SIZE    (0x80000000UL)
  73.  
  74. /* This decides where the kernel will search for a free chunk of vm
  75.  * space during mmap's.
  76.  */
  77. #define TASK_UNMAPPED_BASE    (TASK_SIZE / 3)
  78.  
  79. /*
  80.  * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
  81.  */
  82. #define IO_BITMAP_SIZE    32
  83.  
  84. #define NUM_FPU_REGS    32
  85.  
  86. struct mips_fpu_hard_struct {
  87.     double fp_regs[NUM_FPU_REGS];
  88.     unsigned int control;
  89. };
  90.  
  91. /*
  92.  * FIXME: no fpu emulator yet (but who cares anyway?)
  93.  */
  94. struct mips_fpu_soft_struct {
  95.     long    dummy;
  96. };
  97.  
  98. union mips_fpu_union {
  99.         struct mips_fpu_hard_struct hard;
  100.         struct mips_fpu_soft_struct soft;
  101. };
  102.  
  103. #define INIT_FPU { \
  104.     {{0,},} \
  105. }
  106.  
  107. typedef struct {
  108.     unsigned long seg;
  109. } mm_segment_t;
  110.  
  111. /*
  112.  * If you change thread_struct remember to change the #defines below too!
  113.  */
  114. struct thread_struct {
  115.         /* Saved main processor registers. */
  116.         unsigned long reg16;
  117.     unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
  118.         unsigned long reg29, reg30, reg31;
  119.  
  120.     /* Saved cp0 stuff. */
  121.     unsigned long cp0_status;
  122.  
  123.     /* Saved fpu/fpu emulator stuff. */
  124.     union mips_fpu_union fpu;
  125.  
  126.     /* Other stuff associated with the thread. */
  127.     unsigned long cp0_badvaddr;    /* Last user fault */
  128.     unsigned long cp0_baduaddr;    /* Last kernel fault accessing USEG */
  129.     unsigned long error_code;
  130.     unsigned long trap_no;
  131.     unsigned long pg_dir;                   /* used in tlb refill    */
  132. #define MF_FIXADE 1            /* Fix address errors in software */
  133. #define MF_LOGADE 2            /* Log address errors to syslog */
  134.     unsigned long mflags;
  135.     mm_segment_t current_ds;
  136.     unsigned long irix_trampoline;  /* Wheee... */
  137.     unsigned long irix_oldctx;
  138. };
  139.  
  140. #endif /* !defined (_LANGUAGE_ASSEMBLY) */
  141.  
  142. #define INIT_MMAP { &init_mm, KSEG0, KSEG1, NULL, PAGE_SHARED, \
  143.                     VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
  144.  
  145. #define INIT_TSS  { \
  146.         /* \
  147.          * saved main processor registers \
  148.          */ \
  149.     0, 0, 0, 0, 0, 0, 0, 0, \
  150.                    0, 0, 0, \
  151.     /* \
  152.      * saved cp0 stuff \
  153.      */ \
  154.     0, \
  155.     /* \
  156.      * saved fpu/fpu emulator stuff \
  157.      */ \
  158.     INIT_FPU, \
  159.     /* \
  160.      * Other stuff associated with the process \
  161.      */ \
  162.     0, 0, 0, 0, (unsigned long) swapper_pg_dir, \
  163.     /* \
  164.      * For now the default is to fix address errors \
  165.      */ \
  166.     MF_FIXADE, { 0 }, 0, 0 \
  167. }
  168.  
  169. #ifdef __KERNEL__
  170.  
  171. #define KERNEL_STACK_SIZE 8192
  172.  
  173. #if !defined (_LANGUAGE_ASSEMBLY)
  174.  
  175. /* Free all resources held by a thread. */
  176. extern void release_thread(struct task_struct *);
  177.  
  178. /* Copy and release all segment info associated with a VM */
  179. #define copy_segments(nr, p, mm) do { } while(0)
  180. #define release_segments(mm) do { } while(0)
  181. #define forget_segments()        do { } while (0)
  182.  
  183. /*
  184.  * Return saved PC of a blocked thread.
  185.  */
  186. extern inline unsigned long thread_saved_pc(struct thread_struct *t)
  187. {
  188.     extern void ret_from_sys_call(void);
  189.  
  190.     /* New born processes are a special case */
  191.     if (t->reg31 == (unsigned long) ret_from_sys_call)
  192.         return t->reg31;
  193.  
  194.     return ((unsigned long*)t->reg29)[17];
  195. }
  196.  
  197. extern int (*user_mode)(struct pt_regs *);
  198.  
  199. /*
  200.  * Do necessary setup to start up a newly executed thread.
  201.  */
  202. extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
  203.  
  204. /* Allocation and freeing of basic task resources. */
  205. /*
  206.  * NOTE! The task struct and the stack go together
  207.  */
  208. #define alloc_task_struct() \
  209.     ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
  210. #define free_task_struct(p)    free_pages((unsigned long)(p),1)
  211.  
  212. #define init_task    (init_task_union.task)
  213. #define init_stack    (init_task_union.stack)
  214.  
  215. #endif /* !defined (_LANGUAGE_ASSEMBLY) */
  216. #endif /* __KERNEL__ */
  217.  
  218. /*
  219.  * Return_address is a replacement for __builtin_return_address(count)
  220.  * which on certain architectures cannot reasonably be implemented in GCC
  221.  * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
  222.  * Note that __builtin_return_address(x>=1) is forbidden because GCC
  223.  * aborts compilation on some CPUs.  It's simply not possible to unwind
  224.  * some CPU's stackframes.
  225.  */
  226. #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
  227. /*
  228.  * __builtin_return_address works only for non-leaf functions.  We avoid the
  229.  * overhead of a function call by forcing the compiler to save the return
  230.  * address register on the stack.
  231.  */
  232. #define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
  233. #else
  234. /*
  235.  * __builtin_return_address is not implemented at all.  Calling it
  236.  * will return senseless values.  Return NULL which at least is an obviously
  237.  * senseless value.
  238.  */
  239. #define return_address() NULL
  240. #endif
  241.  
  242. #endif /* __ASM_MIPS_PROCESSOR_H */
  243.